﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GSManager
{
    public partial class InHoaDon : Form
    {
        private int mucluc=0;
        private int sophieuban;
        private DateTime tungay;
        private DateTime denngay;
        public InHoaDon()
        {
            InitializeComponent();
        }
        public InHoaDon(int _mucluc)
        {
            InitializeComponent();
            mucluc = _mucluc;
        }
        public InHoaDon(int _mucluc,int _sophieuban)
        {
            InitializeComponent();
            sophieuban = _sophieuban;
            mucluc = _mucluc;
        }
        public InHoaDon(int _mucluc,DateTime _tungay,DateTime _denngay)
        {
            InitializeComponent();
            mucluc = _mucluc;
            tungay = _tungay;
            denngay = _denngay;
        }
        private void InHoaDon_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'TonKhoDataSet.CHITIETDICHVU' table. You can move, or remove it, as needed.
           
            // TODO: This line of code loads data into the 'PhieuBanDataSet.DataPhieuBanHang' table. You can move, or remove it, as needed.
          
          
           // reportViewer_InHoaDon.LocalReport.re
           // reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("PhieuBanDataSet_DataPhieuBanHang",DataPhieuBanHangBindingSource));
         //   reportViewer_InHoaDon.LocalReport.ReportPath = "ReportPhieuBanHang.rdlc";
          //  this.reportViewer_InHoaDon.RefreshReport();
            switch (mucluc)
            {
                case 0:
                    {
                        this.DataPhieuNoTableAdapter.Fill(this.PhieuNoDataSet.DataPhieuNo, sophieuban);
                        reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("PhieuNoDataSet_DataPhieuNo", DataPhieuNoBindingSource));
                        reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportPhieuNo.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 1:
                    {
                        this.PhieuBanHangTableAdapter.Fill(this.PhieuBanDataSet.DataPhieuBanHang);
                        reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("PhieuBanDataSet_DataPhieuBanHang", DataPhieuBanHangBindingSource));
                        reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportPhieuBanHang.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 2:
                    {
                        this.DataPhieuMuaHangTableAdapter.Fill(this.PhieuMuaDataSet.DataPhieuMuaHang);
                        reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("PhieuMuaDataSet_DataPhieuMuaHang", DataPhieuMuaHangBindingSource));
                        reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportPhieuMuaHang.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 3:
                    {
                        this.DataPhieuDichVuTableAdapter.Fill(this.PhieuDichVuDataSet.DataPhieuDichVu);
                        reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("PhieuDichVuDataSet_DataPhieuDichVu", DataPhieuDichVuBindingSource));
                        reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportPhieuDichVu.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 4:
                    {
                        this.DataPhieuChiTableAdapter.Fill(this.PhieuChiDataSet.DataPhieuChi);
                        reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("PhieuChiDataSet_DataPhieuChi", DataPhieuChiBindingSource));
                        reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportPhieuChi.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 5:
                    {
                        this.DataPhieuGiaCongTableAdapter.Fill(this.PhieuGiaCongDataSet.DataPhieuGiaCong);
                        reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("PhieuGiaCongDataSet_DataPhieuGiaCong", DataPhieuGiaCongBindingSource));
                        reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportPhieuGiaCong.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 6:
                    {
                        this.DataSanPhamTableAdapter.Fill(this.SanPhamDataSet.DataSanPham);
                        this.reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("SanPhamDataSet_DataSanPham", DataSanPhamBindingSource));
                        this.reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportSanPham.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 7:
                    {
                        this.DataDichVuTableAdapter.Fill(this.DichVuDataSet.DataDichVu);
                        this.reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DichVuDataSet_DataDichVu", DataDichVuBindingSource));
                        this.reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportDichVu.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 8:
                    {
                        this.DataKHACHHANGTableAdapter.Fill(this.KhachHangDataSet.DataKHACHHANG);
                        this.reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("KhachHangDataSet_DataKHACHHANG", DataKHACHHANGBindingSource));
                        this.reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportKhachHang.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 9:
                    {
                        this.DataThoGiaCongTableAdapter.Fill(this.ThoGiaCongDataSet.DataThoGiaCong);
                        this.reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("ThoGiaCongDataSet_DataThoGiaCong",DataThoGiaCongBindingSource));
                        this.reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportThoGiaCong.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 10:
                    {
                        this.DataDoanhThuTableAdapter.Fill(this.DoanhThuDataSet.DataDoanhThu);
                        this.reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DoanhThuDataSet_DataDoanhThu", DataDoanhThuBindingSource));
                        this.reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportDoanhThu.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();

                    } break;
                case 11:
                    {
                        this.DataTonKhoTableAdapter.Fill(TonKhoDataSet.DataTonKho);
                        this.reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("TonKhoDataSet_DataTonKho", DataTonKhoBindingSource));
                        this.reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportTonKho.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
                case 12:
                    {
                        this.DataLICHSUTableAdapter.Fill(LichSuDataSet.DataLICHSU, tungay, denngay);
                        this.reportViewer_InHoaDon.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("LichSuDataSet_DataLICHSU", DataLICHSUBindingSource));
                        this.reportViewer_InHoaDon.LocalReport.ReportPath = "BaoCao/ReportLichSu.rdlc";
                        this.reportViewer_InHoaDon.RefreshReport();
                    } break;
            }
        }
       

    }
}
